import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    // indexHeader:'儿童运动鞋'
    list:[]
    
  },
  mutations: {
    // increment(state,t){
    //   state.indexHeader=t;
    //
    // }
    SendShop(state,shop){
       console.log(shop);
     
      if(state.list.length == 0){
        state.list.push(shop);
      }else{
         for(var i=0;i<state.list.length;i++){
              if(state.list[i] == shop){
                state.list[i].quantum++;
                state.list[i].total=state.list[i].Price*state.list[i].quantum;
              }else{
                state.list.push(shop);
              }
      }
    }
     
        
      
      console.log(state.list);
    }
  },
  actions: {

  },
  modules: {
  }
})
